package com.hzdl.car.vo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.*;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class TreeNode implements Serializable {
    private Integer id;
    @JsonProperty("parentId")
    private Integer pid;
    // 参考navs.js来设定属性
    private String title;
    private String icon;
    private String href;
    private  Integer open;
    private Boolean spread;
    private String target;
    private String checkArr = "0";
    // 需要创建号对象，防止空指针
    private List<TreeNode> children = new ArrayList<>();

    public Boolean getSpread() {
        if(open!=null && open==0){
            return false;
        }
        return true ;
    }

    public TreeNode(Integer id, Integer pid, String title, String checkArr) {
        this.id = id;
        this.pid = pid;
        this.title = title;
        this.checkArr = checkArr;
    }
}